package org.shopen.puremvc.controller.theory
{
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	import org.shopen.puremvc.ApplicationConstants;
	import org.shopen.puremvc.model.StagesProxy;
	import org.shopen.puremvc.model.TheoryProxy;
	import org.shopen.puremvc.model.domain.theory.Stage;

	public class InitTheoriesCommand extends SimpleCommand
	{
		override public function execute(notification:INotification):void
		{
			try
			{
				var stagesProxy : StagesProxy = facade.retrieveProxy(StagesProxy.NAME) as StagesProxy;
				var currentStage : Stage = stagesProxy.getCurrentStage();
				
				var theoryProxy : TheoryProxy = facade.retrieveProxy(TheoryProxy.NAME) as TheoryProxy;
				theoryProxy.initData(currentStage);
			}
			catch (error : Error)
			{
				sendNotification(ApplicationConstants.GENERAL_ERROR, error);
			}
		}
	}
}